package net.ojbk.study.twobox.beans.form.post;

import net.ojbk.study.twobox.beans.form.InputItem;
import net.ojbk.study.twobox.beans.po.Student;
import net.ojbk.study.twobox.beans.vo.SelectOption;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: twobox
 * Date: 2019/4/16
 * Time: 11:41
 * Description: No Description
 */
@Component
public class StudentPostForm extends SupperPostForm<Student> {
    private InputItem inputItemClass = new InputItem("分配班级",
            "classid",
            "", "select", null);

    public StudentPostForm() throws Exception {
        // 学生姓名 stuname
        this.inputItems.add(
                new InputItem("学生姓名",
                        "stuname",
                        "", "text"));
        // 性别 stusex
        List<SelectOption> sexList = new ArrayList<>();
        sexList.add(new SelectOption("男", "男"));
        sexList.add(new SelectOption("女", "女"));
        this.inputItems.add(
                new InputItem("性别",
                        "stusex",
                        "男", "select",
                        sexList));

        // 学生状态 stustate
        // (学习中|已升班|已转班|已休学|已流失)
        List<SelectOption> stustateList = new ArrayList<>();
        stustateList.add(new SelectOption("学习中", "学习中"));
        stustateList.add(new SelectOption("已升班", "已升班"));
        stustateList.add(new SelectOption("已转班", "已转班"));
        stustateList.add(new SelectOption("已休学", "已休学"));
        stustateList.add(new SelectOption("已流失", "已流失"));
        this.inputItems.add(
                new InputItem("学生状态",
                        "stustate",
                        "", "select",
                        stustateList));

        // 分配班级 classid
        this.inputItems.add(inputItemClass);


        // 考评等级 checklevel
        // 考评等级(A、B、C、D、E)
        List<SelectOption> checklevelList = new ArrayList<>();
        checklevelList.add(new SelectOption("A", "A"));
        checklevelList.add(new SelectOption("B", "B"));
        checklevelList.add(new SelectOption("C", "C"));
        checklevelList.add(new SelectOption("D", "D"));
        checklevelList.add(new SelectOption("E", "E"));
        this.inputItems.add(
                new InputItem("学生状态",
                        "checklevel",
                        "", "select",
                        checklevelList));

        // 入学时间 begintime
        this.inputItems.add(
                new InputItem("入学时间",
                        "begintime",
                        "1997-04-15", "date"));

        // 就业时间 jobtime
        this.inputItems.add(
                new InputItem("就业时间",
                        "jobtime",
                        "1997-04-15", "date"));
        // 备注 remark
        this.inputItems.add(
                new InputItem("备注",
                        "remark",
                        "", "text"));
    }

    @Override
    public List<InputItem> getInputItems() throws Exception {
        inputItemClass.setOther(this.selectOptionUtil.getSelectOptionListByName("class"));
        return super.getInputItems();
    }
}
